// Element Plus 组件样式覆盖
@import "./variables.scss";

// ===== 主题色覆盖 =====
:root {
  --el-color-primary: #B92B27;
  --el-color-primary-light-3: #{lighten($primary-color, 15%)};
  --el-color-primary-light-5: #{lighten($primary-color, 25%)};
  --el-color-primary-light-7: #{lighten($primary-color, 35%)};
  --el-color-primary-light-8: #{lighten($primary-color, 40%)};
  --el-color-primary-light-9: #{lighten($primary-color, 45%)};
  --el-color-primary-dark-2: #{darken($primary-color, 10%)};
  
  --el-border-radius-base: #{$border-radius-medium};
  --el-border-radius-small: #{$border-radius-small};
  --el-border-radius-round: #{$border-radius-large};
}

// ===== 按钮组件 =====
.el-button {
  border-radius: var(--el-border-radius-base);
  font-weight: 500;
  transition: all 0.2s ease;
  
  &.el-button--primary {
    background-color: $primary-color;
    border-color: $primary-color;
    
    &:hover,
    &:focus {
      background-color: $primary-hover;
      border-color: $primary-hover;
    }
    
    &:active {
      background-color: $primary-active;
      border-color: $primary-active;
    }
  }
  
  &.el-button--text {
    &:hover,
    &:focus {
      background-color: rgba(185, 43, 39, 0.1);
      color: $primary-color;
    }
  }
}

// ===== 输入框组件 =====
.el-input {
  .el-input__wrapper {
    border-radius: var(--el-border-radius-base);
    transition: all 0.2s ease;
    
    &:hover {
      border-color: $primary-color;
    }
    
    &.is-focus {
      border-color: $primary-color;
      box-shadow: 0 0 0 2px rgba(185, 43, 39, 0.1);
    }
  }
}

// ===== 选择器组件 =====
.el-select {
  .el-select__wrapper {
    border-radius: var(--el-border-radius-base);
    
    &:hover {
      border-color: $primary-color;
    }
    
    &.is-focused {
      border-color: $primary-color;
      box-shadow: 0 0 0 2px rgba(185, 43, 39, 0.1);
    }
  }
}

.el-select-dropdown {
  border-radius: var(--el-border-radius-round);
  box-shadow: $shadow-medium;
  
  .el-select-dropdown__item {
    &:hover {
      background-color: rgba(185, 43, 39, 0.1);
      color: $primary-color;
    }
    
    &.is-selected {
      background-color: rgba(185, 43, 39, 0.15);
      color: $primary-color;
      font-weight: 500;
    }
  }
}

// ===== 下拉菜单 =====
.el-dropdown-menu {
  border-radius: var(--el-border-radius-round);
  box-shadow: $shadow-medium;
  border: 1px solid $border-color;
  
  .el-dropdown-menu__item {
    transition: all 0.2s ease;
    
    &:hover {
      background-color: rgba(185, 43, 39, 0.1);
      color: $primary-color;
    }
    
    &:not(.is-disabled):focus {
      background-color: rgba(185, 43, 39, 0.1);
      color: $primary-color;
    }
  }
}

// ===== 消息提示 =====
.el-message {
  border-radius: var(--el-border-radius-round);
  box-shadow: $shadow-medium;
  border: 1px solid;
  
  &.el-message--success {
    background-color: rgba(82, 196, 26, 0.1);
    border-color: $success-color;
    color: $success-color;
  }
  
  &.el-message--warning {
    background-color: rgba(250, 173, 20, 0.1);
    border-color: $warning-color;
    color: $warning-color;
  }
  
  &.el-message--error {
    background-color: rgba(255, 77, 79, 0.1);
    border-color: $error-color;
    color: $error-color;
  }
  
  &.el-message--info {
    background-color: rgba(185, 43, 39, 0.1);
    border-color: $primary-color;
    color: $primary-color;
  }
}

// ===== 对话框 =====
.el-dialog {
  border-radius: var(--el-border-radius-round);
  overflow: hidden;
  
  .el-dialog__header {
    background-color: $background-light;
    border-bottom: 1px solid $border-color;
    padding: $spacing-lg;
    
    .el-dialog__title {
      font-weight: 600;
      color: $text-color;
    }
  }
  
  .el-dialog__body {
    padding: $spacing-lg;
  }
  
  .el-dialog__footer {
    border-top: 1px solid $border-color;
    padding: $spacing-md $spacing-lg;
    background-color: $background-light;
  }
}

// ===== 表格 =====
.el-table {
  border-radius: var(--el-border-radius-base);
  overflow: hidden;
  
  .el-table__header {
    background-color: $background-light;
    
    th {
      background-color: $background-light;
      color: $text-color;
      font-weight: 600;
    }
  }
  
  .el-table__row {
    transition: background-color 0.2s ease;
    
    &:hover {
      background-color: rgba(185, 43, 39, 0.05);
    }
  }
  
  .el-table__cell {
    border-bottom: 1px solid $border-light;
  }
}

// ===== 分页 =====
.el-pagination {
  .el-pager li {
    border-radius: var(--el-border-radius-small);
    margin: 0 2px;
    
    &.is-active {
      background-color: $primary-color;
      color: white;
      border-color: $primary-color;
    }
    
    &:hover:not(.is-active) {
      color: $primary-color;
    }
  }
  
  .btn-next,
  .btn-prev {
    border-radius: var(--el-border-radius-small);
    
    &:hover {
      color: $primary-color;
    }
  }
}

// ===== 标签页 =====
.el-tabs {
  .el-tabs__nav-wrap::after {
    background-color: $border-color;
  }
  
  .el-tabs__item {
    &.is-active {
      color: $primary-color;
    }
    
    &:hover {
      color: $primary-color;
    }
  }
  
  .el-tabs__active-bar {
    background-color: $primary-color;
  }
}

// ===== 卡片 =====
.el-card {
  border-radius: var(--el-border-radius-round);
  box-shadow: $shadow-light;
  border: 1px solid $border-color;
  
  .el-card__header {
    background-color: $background-light;
    border-bottom: 1px solid $border-color;
    font-weight: 600;
  }
}

// ===== 徽章 =====
.el-badge {
  .el-badge__content {
    background-color: $primary-color;
    border-color: $primary-color;
  }
}

// ===== 开关 =====
.el-switch {
  &.is-checked {
    .el-switch__core {
      background-color: $primary-color;
      border-color: $primary-color;
    }
  }
}

// ===== 复选框 =====
.el-checkbox {
  .el-checkbox__input.is-checked {
    .el-checkbox__inner {
      background-color: $primary-color;
      border-color: $primary-color;
    }
  }
  
  .el-checkbox__input.is-indeterminate {
    .el-checkbox__inner {
      background-color: $primary-color;
      border-color: $primary-color;
    }
  }
}

// ===== 单选框 =====
.el-radio {
  .el-radio__input.is-checked {
    .el-radio__inner {
      background-color: $primary-color;
      border-color: $primary-color;
    }
  }
}

// ===== 单选按钮组 =====
.el-radio-button.is-active .el-radio-button__original-radio:not(:disabled)+.el-radio-button__inner {
  background-color: #B92B27;
  border-color: #B92B27;
  color: white;
  box-shadow: -1px 0 0 0 #B92B27;
}

.el-radio-button:first-child .el-radio-button__inner {
  border-left: 1px solid $border-color;
}

.el-radio-button__inner:hover {
  color: $primary-color;
}